package com.blog.wu.myblog.entity;

import com.blog.wu.myblog.base.BaseController;
import com.blog.wu.myblog.base.DataEntity;

import java.util.List;
import java.util.Objects;

/**
 * 用户管理实体类
 *
 * @Date 2018/10/23 上午9:22
 * @Author wuyanshen
 */
public class UserInfo extends DataEntity<UserInfo> {

    private static final long serialVersionUID = 1L;

    private String userName;

    private String userAccount;

    private String userPassword;

    private String userMark;

    private String userPhone;

    private String isLocked;//是否锁定 1：锁定 0：未锁定

    private List<Role> roles;//用户角色

    private String sessionId; //临时字段

    private String ip;//临时字段

    public String getIsLocked() {
        return isLocked;
    }

    public void setIsLocked(String isLocked) {
        this.isLocked = isLocked == null?null:isLocked.trim();
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }

    public String getUserAccount() {
        return userAccount;
    }

    public void setUserAccount(String userAccount) {
        this.userAccount = userAccount == null ? null : userAccount.trim();
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword == null ? null : userPassword.trim();
    }

    public String getUserMark() {
        return userMark;
    }

    public void setUserMark(String userMark) {
        this.userMark = userMark == null ? null : userMark.trim();
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone == null ? null : userPhone.trim();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserInfo userInfo = (UserInfo) o;
        return
                Objects.equals(userName, userInfo.userName) &&
                        Objects.equals(userAccount, userInfo.userAccount) &&
                        Objects.equals(userPassword, userInfo.userPassword) &&
                        Objects.equals(userMark, userInfo.userMark) &&
                        Objects.equals(userPhone, userInfo.userPhone) &&
                        Objects.equals(sessionId, userInfo.sessionId) &&
                        Objects.equals(ip, userInfo.ip);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userName, userAccount, userPassword, userMark, userPhone, sessionId, ip);
    }
}